//
//  LittleBallPropertyViewController.h
//  LittleBall
//
//  Created by  on 12-5-6.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LBPropertyUnit.h"

#define LB_PROP_UNIT_COORDINATE_START_X         0
#define LB_PROP_UNIT_COORDINATE_START_Y         0
#define LB_PROPERTY_UNIT_WIDTH                  70
#define LB_PROPERTY_UNIT_HEIGHT                 70

#define LB_PROPERTY_BUTTON_WIDTH                80
#define LB_PROPERTY_BUTTON_HEIGHT               40

#define LB_PROPERTY_UNSELECTED_ID               -1


@interface LittleBallPropertyViewController : UIViewController
{
    //IBOutlet UIButton     *m_buttonGroup1;
    //IBOutlet UIButton     *m_buttonGroup2;
    IBOutlet UIView       *m_viewFrame;
    //IBOutlet UIView       *m_viewGroup1;
    //IBOutlet UIView       *m_viewGroup2;
    
    // Begin // 道具栏全局图像数据 //
    UIImage               *m_propertiesImageArray[LB_PROPERTY_MAX]; // 各种道具图像缓存
    UIImage               *m_background_unit_normal;
    UIImage               *m_background_unit_selected;
    UIImage               *m_buttonImg_disable;
    UIImage               *m_buttonImg_normal;
    // End // 道具栏全局图像数据 //
    
    // Begin // 道具栏数据 //
    LBPropertyUnit        *m_propertyUnit[LB_PROPERTIES_GROUPNUM][LB_PROPERTIES_GROUPSIZE];
    // End // 道具栏数据 //
    
    //int                   m_currentGroupId; // 当前显示的groupID，从0开始
    
    int                   m_selectedGroupId; // 已选中的GroupID, 从0开始
    int                   m_selectedIndexId; // 已选中的indexID, 从0开始
    
    id                    m_playViewController; // parent view
}


//- (IBAction)onButton_group1:(id)sender;
//- (IBAction)onButton_group2:(id)sender;

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

- (void)initGroups;
- (void)initImages;

- (BOOL)isPropertySelected;
- (void)resetPropertyState;
- (LB_PROPERTY_TYPE)getPropertyType;
- (int)getPropertyLevel;

// 道具即时购买的响应函数
- (IBAction)onButton_buy:(id)sender;

- (void)savePropertiesData;

- (void)checkAndChangeBuyButtonsState;

@property (retain, nonatomic) id m_playViewController;

@end
